/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.crystalrange.help.web;

import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Treeitem;

/**
 *
 * @author tbekasiewicz
 */
public class HelpFolderListener implements EventListener {

    private Treeitem treeitem;

    public HelpFolderListener(Treeitem treeitem) {
        this.treeitem = treeitem;
    }

    public void onEvent(Event event) throws Exception {
        Session session = Sessions.getCurrent();
        session.setAttribute(this.treeitem.getId(), this.treeitem.isOpen());
    }
}
